home *** CD-ROM | disk | FTP | other *** search
/ Hottest 6 / Hottest 6 (1996)(PDSoft)[!].iso / software / videoutils / h-m / mainactor / rexx / dither_adpro.ma < prev    next >
Text File  |  1978-11-24  |  3KB  |  133 lines

  1. /*
  2.  *
  3.  *     Dither V 1.0, 1993 Markus Moenig
  4.  *
  5.  *     Dithers the source project to a requested amount of colours, needs AdPro !!
  6.  *     The new project gets the name of the source project + ".new"
  7.  *     and is also converted to the saver module type of the source project.
  8.  *
  9.  *     The loader/saver of the source project can be either picture
  10.  *     or animation modules.
  11.  *
  12.  *     A new project will be opened for the resulting pictures/animation.
  13.  */
  14.  
  15. OPTIONS RESULTS
  16.  
  17. ADDRESS MAINACTOR 
  18.  
  19. ScreenToFront
  20. PrintAndStoreTXT "Dither V1.0, dithering project ..."
  21.  
  22. IF ~SHOW('P','ADPro') THEN DO  /* if not allready running, start adpro */
  23.     ADDRESS MAINACTOR PrintTXT "Invoking AdPro ..."
  24.     ADDRESS COMMAND 'run >NIL: <NIL: adpro:adpro BEHIND MAXMEM=1000000'
  25.     ADDRESS COMMAND Wait 5
  26. END  
  27.  
  28. ADDRESS MAINACTOR
  29.  
  30. GetSPName
  31.  
  32. IF rc = 0 THEN DO                          /* check if project loaded */
  33.  
  34.     PARSE VAR RESULT firstname secondname .  /* store name of the animation */
  35.                                              /* or the names of the picture list */
  36.     ScreenToFront
  37.  
  38.     DeSelectAll
  39.  
  40.     GetSPSaver
  41.     PARSE VAR RESULT savertype savername .   /* store type, name of saver module */
  42.  
  43.                                            /* Store general infos of the project */
  44.     GetSPInfo
  45.     PARSE VAR RESULT width height colors pics caching loop cpf .
  46.  
  47.     colors=16
  48.  
  49.     RequestInteger colors "Enter amount of Colours (0=HAM, 1=HAM8)"
  50.     IF RC = 10 THEN DO
  51.         PrintTXT "Aborting ..."
  52.         EXIT
  53.     END
  54.     NewColors=RESULT
  55.     IF NewColors = 0 THEN NewColors="HAM"
  56.     IF NewColors = 1 THEN NewColors="HAM8"
  57.     
  58.     IF savertype = "PIC" THEN
  59.         picformat=savername
  60.     ELSE DO
  61.         picformat=IFF
  62.         SetSPSaver PIC picformat
  63.     END
  64.     
  65.     ADDRESS "ADPro"
  66.         LFormat "Universal"
  67.         PSTATUS UNLOCKED
  68.         ORIENTATION PORTRAIT
  69.         SFormat picformat
  70.  
  71.     ADDRESS MAINACTOR
  72.  
  73.     newname = firstname || ".new"            /* new name = old one + ".new" */
  74.  
  75.     SelectAll
  76.     
  77.     saveargs=newname
  78.         
  79.     Save saveargs                            /* Save Pictures */
  80.  
  81.     DO i=1 to pics                           /* Scale all pics */
  82.  
  83.         actualpic=newname || "." || Right("00000" || i, 5)
  84.     PrintTxt "ADPro dithers Picture" i
  85.  
  86.         ADDRESS "ADPro"    
  87.         Load actualpic
  88.         RENDER_TYPE NewColors
  89.         PSORT 0
  90.         Execute    
  91.         Save actualpic IMAGE
  92.  
  93.         ADDRESS MAINACTOR
  94.  
  95.     END
  96.  
  97.     IF caching = "CACHING=YES" THEN                 /* Was the old project cached ? */
  98.         
  99.         OpenNewProject "CACHING"               /* If yes new project is also cached */
  100.     
  101.     ELSE 
  102.         
  103.         OpenNewProject                         /* If not new project is not cached */
  104.  
  105.     SetSPLoader PIC picformat                /* Set the new projects loader module */
  106.  
  107.     firstpic=newname || "." || Right("00000" || 1, 5)
  108.     lastpic=newname || "." || Right("00000" || pics, 5)
  109.  
  110.     LoadProject firstpic lastpic             /* Load picture list */
  111.  
  112.     SetSPSaver savertype savername
  113.  
  114.     IF savertype = "ANIM" THEN DO            /* If we wanted a new animation, */
  115.                                              /* we have to build it */
  116.         SelectAll
  117.         saveargs=newname || " " || cpf || " " || loop
  118.         Save saveargs
  119.         UnloadProject
  120.         
  121.         DO i=1 TO pics                         /* delete temporary pics */
  122.             actualpic=newname || "." || Right("00000" || i, 5)
  123.             PrintTxt "Delete " || actualpic
  124.             ADDRESS COMMAND    "delete " || actualpic || "#?"
  125.         END
  126.         
  127.         SetSPLoader savertype savername
  128.         LoadProject newname
  129.     END
  130.     
  131.     PrintAndStoreTXT "READY !!!!"
  132. END
  133.